package com.atguigu.flink.streamapi.trans;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * Created by Smexy on 2023/1/13
 */
public class Demo2_Filter
{
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        DataStreamSource<Integer> ds = env.fromElements(1, 2, 3, 4, 5, 6);

        //只留下返回true的数据
        ds.filter(num -> num % 2 == 0)
          .print();

        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }




    }
}
